package com.lxyk.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.github.pagehelper.PageInfo;
import com.lxyk.mapper.WaterDetailsMapper;
import com.lxyk.pojo.WaterDetails;
import com.lxyk.service.WaterDetailsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
//用service层的mybatis plus在实体类还要继承ServiceImpl 这里还是不用了 因为我们不是单表

//public class WaterDetailsServiceImpl extends ServiceImpl<WaterDetailsMapper,WaterDetails> implements WaterDetailsService {
@Service
public class WaterDetailsServiceImpl  implements WaterDetailsService {

    @Autowired
    private WaterDetailsMapper waterDetailsMapper;

    /*@Transactional：开启事务 放在接口实现类或接口实现方法上 还要在主启动类上加@EnableTransactionManagement注解
    * 等价于xml配置方式的<tx:annotation-driven>*/
    //@Transactional
    @Override
    public PageInfo<WaterDetails> queryWaterDetails(WaterDetails waterDetails, Integer pageNum, Integer pageSize) {
        List<WaterDetails> waterDetailsList = waterDetailsMapper.queryWaterDetails(waterDetails);
        return new PageInfo<>(waterDetailsList);
    }
}
